package com.jeecg;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author gml
 * @description: TODO
 * @date 2020/5/14 14:38
 */
@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有请求，记录日志
        registry.addInterceptor(LogInterceptor()).addPathPatterns("/**");
    }

    @Bean
    public LogInterceptor LogInterceptor(){
        return new LogInterceptor();
    }
}
